<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>find方法</title>
</head>

<body>
    <script type="text/javascript">
        var ary = [{
            id: 1,
            name: '张三'
        }, {
            id: 2,
            name: '李四'
        }];
        let target = ary.find(item => item.id == 2);
        console.log(target)
    </script>
</body>

</html>